UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fz61qoaClkwc3GoJSKtnKtWv5pIfuUWEGmepCscNy5A=' 
WHERE 
  key_id = 'd17710060f0dc58e3e0f69247087361d8e8d204766907a527da3e53c0ef49f96' 
  AND (
    token = 'fz61qoaClkwc3GoJSKtnKtWv5pIfuUWEGmepCscNy5A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044