UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uR1+qrdMwe6JwoAsbE8y5V4ePc1hTjq5j+MpAjPTsw4=' 
WHERE 
  key_id = 'c85e8042925e19ffb68f47e082acb81a8b5e2a4c09ba6ee426022376b47d7203' 
  AND (
    token = 'uR1+qrdMwe6JwoAsbE8y5V4ePc1hTjq5j+MpAjPTsw4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024