UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HJlh7O7uo3jZN44nzpEP7Vs6bYc8mpPFdX11O/063Ec=' 
WHERE 
  key_id = '78b8cbc6fff434a654e8398a23793042d0c48ded382cb901d97cc66c3c33dfef' 
  AND (
    token = 'HJlh7O7uo3jZN44nzpEP7Vs6bYc8mpPFdX11O/063Ec=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036