UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZHCJ2DdfzDgopG4CNDxIjKmuZjBH8pic+M+xxq0vD9U=' 
WHERE 
  key_id = '6bd52a54955863a0d41bc2936fe4b946ddd33eb806f867d39bbbaca36f389420' 
  AND (
    token = 'ZHCJ2DdfzDgopG4CNDxIjKmuZjBH8pic+M+xxq0vD9U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048