UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tLljtfYZhCMa6Wo93L4GhGiwkw28rDT2FJLaaKjW6ws=' 
WHERE 
  key_id = '9b677d5528341bfbe788aed6d3de642a98b4639ef985ce5f78535095bf0b6d82' 
  AND (
    token = 'tLljtfYZhCMa6Wo93L4GhGiwkw28rDT2FJLaaKjW6ws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049