UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tcqm4Ok67fA63xULRxYDUDwziNNa5WoPdraF590GWOo=' 
WHERE 
  key_id = '616a2a271087b0c0892759ed5aa258b75e795cdde0182ad5f47f4680f3b41a44' 
  AND (
    token = 'tcqm4Ok67fA63xULRxYDUDwziNNa5WoPdraF590GWOo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031