UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CJMZP/FjUGsJYGC4i0xAe7PdI8s6jUHiG1y417cyEtE=' 
WHERE 
  key_id = '877c4d4b17ba4f832fcc3d2dd5ea2c18d4ab0aa38b62647490706e01d8e92b87' 
  AND (
    token = 'CJMZP/FjUGsJYGC4i0xAe7PdI8s6jUHiG1y417cyEtE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038