UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Lc2Zj26IznAAGc3TsiPhTxcj7mORElJT0/f+FZk+ZlY=' 
WHERE 
  key_id = 'a3270d7563f1e8c3caf293f5a0e73a2a2b59dcbb4868a15e3b25b30e529659c5' 
  AND (
    token = 'Lc2Zj26IznAAGc3TsiPhTxcj7mORElJT0/f+FZk+ZlY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025