UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3zAo3k7no5q239vua+4Uex8fMitWGzpQs2zVzOud1ZM=' 
WHERE 
  key_id = '4266fb6a51a8b7918e4eb3d03d55bab07b77edb81b988942b594fdeeda0f1456' 
  AND (
    token = '3zAo3k7no5q239vua+4Uex8fMitWGzpQs2zVzOud1ZM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032