UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MqmVngrERvRQXxxyKUvR2MQl3rii/HFQkI+6+Hop7nE=' 
WHERE 
  key_id = '836165a57237ac219a26c0b1ae316c175bc5f4620fab5e4667ebea7aaae9a504' 
  AND (
    token = 'MqmVngrERvRQXxxyKUvR2MQl3rii/HFQkI+6+Hop7nE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035