UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ucpMTTNSf9rmOZEdWmf9BR9cy0CQ6kXuwngj+NHo73E=' 
WHERE 
  key_id = '30eda30751c00f3208f994c14030a75d312300515809719e5d9eb549d53eb486' 
  AND (
    token = 'ucpMTTNSf9rmOZEdWmf9BR9cy0CQ6kXuwngj+NHo73E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037