UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1KloDqljwpS7LQwuzP8wXLVChEHzUsXG01NWvX+hXps=' 
WHERE 
  key_id = '8e21cb88b65c0d2ce224df6c78bc33d2e979942bf03b69eb27cc6801fc054fc8' 
  AND (
    token = '1KloDqljwpS7LQwuzP8wXLVChEHzUsXG01NWvX+hXps=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047