UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gkIR8PnSKCQbZnIjBi8Ce/BHoRu0KcJoGEGXW+YjsBY=' 
WHERE 
  key_id = '1d9cd5cb55a8140eb9d6ea6482dbd1fd739bfc0aa33e0219647e911ad6d59cf2' 
  AND (
    token = 'gkIR8PnSKCQbZnIjBi8Ce/BHoRu0KcJoGEGXW+YjsBY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041