UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H53mE59VEwRQ5YPQbMpc4ZzkBv0krnPDFn+LGJn0WR0=' 
WHERE 
  key_id = 'f0fef142d469eb25fff37d9ad5a63de3d369cae7344f82ac11a22752502fa450' 
  AND (
    token = 'H53mE59VEwRQ5YPQbMpc4ZzkBv0krnPDFn+LGJn0WR0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034