UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T0mVA2h86RB/SKzpXz094XyMUYMk3IxEQ1eo37Ljq0M=' 
WHERE 
  key_id = '5b6beadce0ca88431eb4716e1c262ba10225e20a565d86e45f706e91af1c7474' 
  AND (
    token = 'T0mVA2h86RB/SKzpXz094XyMUYMk3IxEQ1eo37Ljq0M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034