UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i0rwjlI0By7i41VNgQiqqjTnDal31/5Sq9oryWGvRNg=' 
WHERE 
  key_id = 'c5edbf6b9e0aef1223abdd5205f99244daec54e2efb5723997e0d789dffceccc' 
  AND (
    token = 'i0rwjlI0By7i41VNgQiqqjTnDal31/5Sq9oryWGvRNg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029