UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D0py0u7BGsrDp8A5fxELHramvVRloIYDUhWKbHlUr6c=' 
WHERE 
  key_id = '06d25b8332af2d7de9fd14d0d19b36f3f7d40e09bbdd7b017aae06a5baaaa571' 
  AND (
    token = 'D0py0u7BGsrDp8A5fxELHramvVRloIYDUhWKbHlUr6c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017