UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XL7HfFhV55v8jgGUtQ68Cf6BUo8TFzmEGkNOezvLAl0=' 
WHERE 
  key_id = 'cb066a4ceb78ca56121826cd486872bb683c5656f9a76a325ded6f17649a584e' 
  AND (
    token = 'XL7HfFhV55v8jgGUtQ68Cf6BUo8TFzmEGkNOezvLAl0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022