UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9eNaFoArb5EQJaKC18YWdqf+D3RbSgSBgPuTcnWQycg=' 
WHERE 
  key_id = '25cc62b74f8f43e0b195a83a3de556f5ecb1e9977f3d5be4ae8bebf9036ad5f9' 
  AND (
    token = '9eNaFoArb5EQJaKC18YWdqf+D3RbSgSBgPuTcnWQycg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023