UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jkt9Y57tly5T2u3kvSkfrjH8ne7ddUGYxtNCHKOnUIU=' 
WHERE 
  key_id = 'd1d4ca6bdb76a22541f8c6d16f22feffe6a277c77420e9485786e22b4937772d' 
  AND (
    token = 'jkt9Y57tly5T2u3kvSkfrjH8ne7ddUGYxtNCHKOnUIU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052