UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RP8UNnnBiW7iXzV9X4p6Tk+P/wJDiNmkZYkZXiz/IcQ=' 
WHERE 
  key_id = 'b4fb51dbffc38bdbe48aedaa11dd4da176decf8f6933aa311771ca75dcec434a' 
  AND (
    token = 'RP8UNnnBiW7iXzV9X4p6Tk+P/wJDiNmkZYkZXiz/IcQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037