UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NUWrW6O8HpVX2TB3l++nNgBYWoW89jKce4S46bw1PPE=' 
WHERE 
  key_id = '117702a584b477092c8f2da1a34cbdf1affbdabb360a3deb7902ad3a48488df1' 
  AND (
    token = 'NUWrW6O8HpVX2TB3l++nNgBYWoW89jKce4S46bw1PPE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035