UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UbuvRt2wZsnE70QrGQuAP69iEB+G35i4qx/nX+ni9+8=' 
WHERE 
  key_id = '2f5b8cacd137cb6160c16f993ff8fba487b5edb080930f52db0577df0826e28d' 
  AND (
    token = 'UbuvRt2wZsnE70QrGQuAP69iEB+G35i4qx/nX+ni9+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058