UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '83CA+O9wHj2wzJpRTEsOs3BysLzM8Brd3c77FVxxNik=' 
WHERE 
  key_id = '42242f08a9316e06c637fcf931ffae947b200082671263e741c26a64cbb019e7' 
  AND (
    token = '83CA+O9wHj2wzJpRTEsOs3BysLzM8Brd3c77FVxxNik=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032