UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yt+xr9NDV09A+1tduBsiM+jy0hWrILye9Y1FhSCQptA=' 
WHERE 
  key_id = '09122a21be086231419b947d1c1fdb7e3fab73b5d95440100401b8c57067aace' 
  AND (
    token = 'yt+xr9NDV09A+1tduBsiM+jy0hWrILye9Y1FhSCQptA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046