UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EvA2DlY9p+27ahE+qUdtPq0Y9vvTJ8K37tuFxQQ6HN0=' 
WHERE 
  key_id = 'c0cfe0ae06bbdfa20b03ff126b2379063935877e23f60b0eafbc9549978617f5' 
  AND (
    token = 'EvA2DlY9p+27ahE+qUdtPq0Y9vvTJ8K37tuFxQQ6HN0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026