UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k97JmsxTG/meHpRrvliWjGsouWxVmU3lRctql/hIsBw=' 
WHERE 
  key_id = '2cfeca2dca55d0a5348196a6bc095828486d167cfd8448089a53670b38cdceb5' 
  AND (
    token = 'k97JmsxTG/meHpRrvliWjGsouWxVmU3lRctql/hIsBw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043