UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PZjAw8KF2cOlXcd0cfQgDQX5JtNKb60EoXtg38StDQg=' 
WHERE 
  key_id = '38ff89f21df276c1253bb9711d2b89ff05f2f010bd048346d0808521689761c5' 
  AND (
    token = 'PZjAw8KF2cOlXcd0cfQgDQX5JtNKb60EoXtg38StDQg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035