UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mwSz2SQhG89nI8dgbNIZ4Leot5jjmCFsJdlcrZsh/TQ=' 
WHERE 
  key_id = '6512519f30dd5dc602127dfc4e56d6c7d0424986e253e68b14d70d27b933c7b2' 
  AND (
    token = 'mwSz2SQhG89nI8dgbNIZ4Leot5jjmCFsJdlcrZsh/TQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042