UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DfCdZ3KM5ar6BL2h11ySvppJQbcZQLkNlSQ9RR8dl9M=' 
WHERE 
  key_id = '1f7e893a97314183eb557dffbb5a02fe7e39a6a20085fe6e8a5f2fe567837a6a' 
  AND (
    token = 'DfCdZ3KM5ar6BL2h11ySvppJQbcZQLkNlSQ9RR8dl9M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029