UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5HREVrf5L53MOtlBYldSMX6R9ECaRElemE6CdQHtuCk=' 
WHERE 
  key_id = '032a0b6bcce3a8f0c3121f7d310e66a789b3344557e36d4dda8993d78af850fa' 
  AND (
    token = '5HREVrf5L53MOtlBYldSMX6R9ECaRElemE6CdQHtuCk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037