UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CGbk0jGbwu7GFdpPg3PIGyDwlnf/zZSPNgq6Y5pGM0o=' 
WHERE 
  key_id = '7b8f9512dd3a7b347121bfb80129cb5749998b939381bb7ef50193a279f6320a' 
  AND (
    token = 'CGbk0jGbwu7GFdpPg3PIGyDwlnf/zZSPNgq6Y5pGM0o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034