UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nheiFjGDTyUM1DO+10auIzXO6i9/c3Mek7su8B7FJdY=' 
WHERE 
  key_id = 'c02d1b106334c6df0b6ea642cd3bec9c4a8782d156f818462b98a86ab2abdef7' 
  AND (
    token = 'nheiFjGDTyUM1DO+10auIzXO6i9/c3Mek7su8B7FJdY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046