UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eMjtTpOrMmPz5C6nHAJGiCY2NGazD28zIETbV0vosXU=' 
WHERE 
  key_id = '5125fa5843543b461322dd2d6788fb718d71cd7b8bb0d3966e1ecdd7d8d3a9e9' 
  AND (
    token = 'eMjtTpOrMmPz5C6nHAJGiCY2NGazD28zIETbV0vosXU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043